/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.muni.fi.pa165.carparkweb.utils;

import cz.muni.fi.pa165.carpark.TO.ServiceCheckTO;
import cz.muni.fi.pa165.carpark.TO.VehicleTO;
import cz.muni.fi.pa165.carpark.servicies.VehicleService;
import java.util.List;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 *
 * @author xmarton1
 */
public class CollectionUtils {    

    private static VehicleService vehSer;
    
    public static boolean contains(Object o1, Object o2){        
        VehicleTO vehicle = (VehicleTO)o1;
        ServiceCheckTO service = (ServiceCheckTO)o2;
        ApplicationContext context = new ClassPathXmlApplicationContext("classpath*:applicationContext.xml");
        vehSer = (VehicleService) context.getBean("vehicleService");        
        List<ServiceCheckTO> list =  vehSer.getActiveServiceChecks(vehicle,true);    
        System.err.println(list);
        boolean t = list.contains(service);       
        return t;
    }

    

}
